function myIsNaN(val) {
  return typeof val === "number" && isNaN(val);
};

function indexOfNaN(arr) {
  for (let i = 0; i < arr.length; i++) {
    if (myIsNaN(arr[i])) {
      return i;
    }
  }
  return -1;
};

function lastIndexOfNaN(arr) {
  for (let i = arr.length - 1; i >= 0; i--) {
    if (myIsNaN(arr[i])) {
      return i;
    }
  }
  return -1;
};

const hasNaN = myArray.some(myIsNaN);

const hasNaN1 = indexOfNaN(myArray) >= 0;

const firstIndex = indexOfNaN(myArray);

const lastIndex = lastIndexOfNaN(myArray);

// ES2015
const hasNaN2 = myArray.some(Number.isNaN);

// ES2015
const firstIndex1 = myArray.findIndex(Number.isNaN);

// ES2016
const hasNaN3 = myArray.includes(NaN);

indexOf(NaN)
lastIndexOf(NaN)
new foo.indexOf(NaN)
foo.bar(NaN)
foo.IndexOf(NaN)
foo[indexOf](NaN)
foo[lastIndexOf](NaN)
indexOf.foo(NaN)
foo.indexOf()
foo.lastIndexOf()
foo.indexOf(a)
foo.lastIndexOf(Nan)
foo.indexOf(a, NaN)
foo.indexOf(a, b)
foo.indexOf(...NaN)
foo.lastIndexOf(NaN())

indexOf(Number.NaN)
lastIndexOf(Number.NaN)
new foo.indexOf(Number.NaN)
foo.bar(Number.NaN)
foo.IndexOf(Number.NaN)
foo[indexOf](Number.NaN)
foo[lastIndexOf](Number.NaN)
indexOf.foo(Number.NaN)
foo.lastIndexOf(Number.Nan)
foo.indexOf(a, Number.NaN)
foo.indexOf(...Number.NaN)
foo.lastIndexOf(Number.NaN())